package servlet;


import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.List;

/*request 作用域
* 通过该对象可以在一个请求中传递数据：作用范围：在一次请求中生效，即服务器跳转有效。（请求转发跳转时有效）*/
@WebServlet("/s06")
public class servlet06 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("servlet06");
        //获取域对象内容
        String name = request.getAttribute("name").toString();
        System.out.println("name:" + name);
        String age = request.getAttribute("age").toString();
        System.out.println("age:" + age);
        List<String> lsit = (List<String>) request.getAttribute("lift");
        System.out.println("lift:" + lsit.get(0));


     }
}
